home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shw_alldivrooms.cog < prev    next >
Text File  |  1999-11-15  |  46KB  |  1,712 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shw_DivRoom2_sluice.cog
  4. #
  5. # Sluiceway Alternating Script
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     message    startup        
  14.     message    activated    
  15.     message    user0        
  16.     message    user1        
  17.     message    pulse        
  18.  
  19. #    cogs        
  20.     cog     troopcog
  21.     cog     bucketcog
  22.     cog     hammercamcog
  23.     #cog     Portcog
  24.     cog     Sluicecog1
  25.     cog     Sluicecog2
  26.     cog     Powerdoorcog    
  27.     cog     camcog    
  28.     #cog     hintcog    
  29.  
  30. #    DivRoom1 Things
  31.     thing    D1sluice0
  32.     thing   D1indy            nolink
  33.     thing    D1camerapos
  34.     thing    D1lever
  35.     thing    D1camtarget
  36.     thing    D1waterobj1
  37.     thing    D1waterobj2
  38.     thing    D1H2Ohome1
  39.     thing    D1H2Ohome2
  40.     thing    D1splashpos
  41.  
  42.     thing    D1soundobj
  43.     thing    D1soundobj2
  44.  
  45. #    DivRoom1 waterobject sectors
  46.     sector  D1water1sect
  47.     sector  D1water2sect
  48.  
  49.  
  50. #    DivRoom2 Things
  51.     thing    D2sluice0
  52.     thing   D2indy            nolink
  53.     thing    D2camerapos    
  54.     thing    D2camtarget
  55.     thing    D2lever
  56.     thing    D2waterobj1
  57.     thing    D2waterobj2
  58.     thing    D2H2Ohome1
  59.     thing    D2H2Ohome2
  60.     thing    D2splashpos
  61.     
  62.     thing    D2soundobj
  63.     thing    D2soundobj2
  64.     
  65.         
  66. #    DivRoom2 waterobject sectors
  67.     sector  D2water1sect
  68.     sector  D2water2sect
  69.  
  70.  
  71. #    DivRoom3 Things
  72.     thing    D3sluice0
  73.     thing   D3indy            nolink
  74.     thing    D3camerapos    
  75.     thing    D3lever
  76.     thing    D3camtarget
  77.     thing    D3waterobj1
  78.     thing    D3waterobj2
  79.     thing    D3H2Ohome1
  80.     thing    D3H2Ohome2
  81.     thing    D3splashpos
  82.     
  83.  
  84. #    DivRoom2 waterobject sectors
  85.     sector  D3water1sect
  86.     sector  D3water2sect
  87.     
  88.  
  89.  
  90. #    global things for creation
  91.     thing    splashitem            local
  92.  
  93.  
  94. #    control variables    
  95.     int      action=0            local
  96.     int      D1position=0        local
  97.     int      D2position=0        local
  98.     int      D3position=0        local
  99.     int      thaw=0                local
  100.     int      D2thaw=0                local
  101.     int      D3thaw=0                local
  102.     int      index                local
  103.     int      curCam                local
  104.     int      D1fx=0            local
  105.     int      D2fx=0            local
  106.     int      D3fx=0            local
  107.     int      commiecreate=0            local
  108.     int      sluicehint=0            local
  109.     
  110.     
  111. #    keyframe variables
  112.     int      D1sluicemove            local
  113.     int      D1sluicemove1            local
  114.     int      D2sluicemove            local
  115.     int      D2sluicemove1            local
  116.     int      D3sluicemove            local
  117.     int      D3sluicemove1            local
  118.  
  119. #    sound variables    
  120.     int      gatetrack            local
  121.     int      rushtrack            local
  122.     int      geartrack            local
  123.     int      movetrack            local
  124.  
  125.     int      D1ambloop            local
  126.     int      D1ambloop2            local
  127.     int      D1ambloop3            local
  128.     int      D2ambloop            local
  129.     int      D2ambloop2            local
  130.     int      D2ambloop3            local
  131.     int      D3ambloop            local
  132.  
  133. # Indy Keyframes
  134.     keyframe    in_pull=in_pull_lever_down.key        local
  135.     keyframe    lever_down=gen_lever.key            local
  136.  
  137. # Sluice Gate keyframes        
  138.     keyframe    sluice_open=shw_gate_dflct.key        local
  139.     keyframe    sluice_close=shw_gate_open.key        local
  140.     keyframe    sluice2_close=shw_gate_openb.key    local
  141.     keyframe    sluice2_open=shw_gate_dflctb.key    local
  142.     
  143. #    templates for created objects
  144.     template        water1obj=15mh2o
  145.     template        water2obj=15mh2o
  146.     template        splash=TitanicH2Ofx        local
  147.     
  148. #    water sector light value    
  149.     vector  sect_light      local
  150.  
  151. #Div1 sectors and surfs
  152.     sector    D1path1_sect_0
  153.     sector    D1path1_sect_1
  154.     sector    D1path1_sect_2
  155.     sector    D1path1_sect_3
  156.     sector    D1path1_sect_4
  157.     sector    D1path1_sect_5
  158.     sector    D1path1_sect_6
  159.     sector    D1path1_sect_7
  160.     sector    D1path1_sect_8
  161.     sector    D1path1_sect_9
  162.     sector    D1path1_sect_10
  163.     sector    D1path1_sect_11
  164.     sector    D1path1_sect_12
  165.  
  166.     sector    D1path2_sect_0
  167.     
  168.     surface D1path2_surf_0
  169.     surface D1path2_surf_1
  170.     
  171.     surface D1path1_surf_0
  172.     surface D1path1_surf_1
  173.     surface D1path1_surf_2
  174.     surface D1path1_surf_3
  175.     surface D1path1_surf_4
  176.     surface D1path1_surf_5
  177.     surface D1path1_surf_6
  178.     surface D1path1_surf_7
  179.     surface D1path1_surf_8
  180.     surface D1path1_surf_9
  181.     surface D1path1_surf_10
  182.     surface D1path1_surf_11
  183.     surface D1path1_surf_12
  184.     surface D1path1_surf_13
  185.     surface D1path1_surf_14
  186.     surface D1path1_surf_15
  187.     surface D1path1_surf_16
  188.     surface D1path1_surf_17
  189.     surface D1path1_surf_18
  190.     surface D1path1_surf_19
  191.     surface D1path1_surf_20
  192.     surface D1path1_surf_21
  193.     surface D1path1_surf_22
  194.     surface D1path1_surf_23
  195.     surface D1path1_surf_24
  196.     surface D1path1_surf_25
  197.         
  198. #Div2 sectors and surfs
  199.     sector    D2path1_sect_0
  200.     sector    D2path1_sect_1
  201.     sector    D2path1_sect_2
  202.     
  203.     sector    D2path2_sect_0
  204.     sector    D2path2_sect_1
  205.     sector    D2path2_sect_2
  206.     sector    D2path2_sect_3
  207.     
  208.     surface D2path1_surf_0
  209.     surface D2path1_surf_1
  210.     surface D2path1_surf_2
  211.     surface D2path1_surf_3
  212.     surface D2path1_surf_4
  213.     surface D2path1_surf_5
  214.     
  215.     surface D2path2_surf_0
  216.     surface D2path2_surf_1
  217.     surface D2path2_surf_2
  218.     surface D2path2_surf_3
  219.     surface D2path2_surf_4
  220.     surface D2path2_surf_5
  221.     surface D2path2_surf_6
  222.     surface D2path2_surf_7
  223.  
  224. #Div3 sectors and surfs
  225.     sector    D3path1_sect_0
  226.     sector    D3path1_sect_1
  227.     sector    D3path1_sect_2
  228.     sector    D3path1_sect_3
  229.     
  230.     sector    D3path2_sect_0
  231.     sector    D3path2_sect_1
  232.     
  233.     surface D3path1_surf_0
  234.     surface D3path1_surf_1
  235.     surface D3path1_surf_2
  236.     surface D3path1_surf_3
  237.     surface D3path1_surf_4
  238.     surface D3path1_surf_5
  239.     surface D3path1_surf_6
  240.     surface D3path1_surf_7
  241.     
  242.     surface D3path2_surf_0
  243.     surface D3path2_surf_1
  244.     surface D3path2_surf_2
  245.  
  246. #    lever sound fx        
  247.     sound   leverpull=nub_lever_pull_c.wav          local
  248.     sound   leverset=nub_lever_reset_c.wav          local
  249.     
  250. #    sluice gate sound fx        
  251.     sound   gatestart=shw_sluice_start.wav          local
  252.     sound   gaterun=shw_sluice_move.wav          local
  253.     sound   gatestop=shw_sluice_stop.wav          local
  254.     
  255. #    environmental event sound fx        
  256.     sound   waterrush=nub_bull_move2_c.wav          local
  257.     sound   geargrind=nub_bull_move5_c.wav          local
  258.     sound   bigmove=nub_bull_move1_c.wav              local
  259.     sound    sluicesrun=shs_h2odrain_c.wav            local
  260.  
  261.  
  262. end
  263. # ========================================================================================
  264.  
  265. code
  266. startup:
  267.  
  268.         #    Get local player and clear all channel sectors of water
  269.         sluicehint=0;
  270.         player = GetLocalPlayerThing();
  271.         call ClearAllDiv1;
  272.         call ClearAllDiv2;
  273.         call ClearAllDiv3;
  274.         
  275.         
  276. return;
  277.  
  278.  
  279. # ========================================================================================
  280. ClearAllDiv1:
  281.  
  282. #    tag water objects as invisible
  283. SetThingFlags(D1waterobj1, 0x10);
  284. SetThingFlags(D1waterobj2, 0x10);
  285.  
  286. #    set water sector light to nothing
  287. sect_light = VectorSet(0.0, 0.0, 0.0);
  288.  
  289. #path1 clearing
  290.         for (index = 0; index < 13; index = index + 1)
  291.             {
  292.             
  293.             #Clearing sector water attributes
  294.             Setsectorlight(D1path1_sect_0[index], sect_light, 3);
  295.             ClearSectorFlags(D1path1_sect_0[index], 0x2);
  296.             ClearSectorSurfFlags(D1path1_sect_0[index], 0x20000);
  297.             }
  298.         
  299.         for (index = 0; index < 26; index = index + 1)
  300.             {
  301.             #setting faces to no draw
  302.             Setfacegeomode(D1path1_surf_0[index], 0);
  303.             }
  304.          
  305.          
  306. #path2 clearing
  307.         
  308.         for (index = 0; index < 1; index = index + 1)
  309.             {
  310.             
  311.             #Clearing sector water attributes
  312.             Setsectorlight(D1path2_sect_0[index], sect_light, 3);
  313.             Clearsectorflags(D1path2_sect_0[index], 0x2);
  314.             ClearSectorSurfFlags(D1path2_sect_0[index], 0x20000);
  315.             }
  316.         
  317.         for (index = 0; index < 2; index = index + 1)
  318.             {
  319.             #setting faces to no draw
  320.             Setfacegeomode(D1path2_surf_0[index], 0);
  321.             }
  322. return;
  323.  
  324. # ========================================================================================
  325. ClearAllDiv2:
  326.  
  327. #    tag water objects as invisible
  328. SetThingFlags(D2waterobj1, 0x10);
  329. SetThingFlags(D2waterobj2, 0x10);
  330.  
  331. #    set water sector light to nothing
  332. sect_light = VectorSet(0.0, 0.0, 0.0);
  333.     
  334. #clearing path1
  335.         for (index = 0; index < 3; index = index + 1)
  336.             {
  337.             #Clearing sector water attributes
  338.             Setsectorlight(D2path1_sect_0[index], sect_light, 3);
  339.             Clearsectorflags(D2path1_sect_0[index], 0x2);
  340.             ClearSectorSurfFlags(D2path1_sect_0[index], 0x20000);
  341.             }
  342.        
  343.         for (index = 0; index < 6; index = index + 1)
  344.             {
  345.             #setting faces to no draw
  346.             Setfacegeomode(D2path1_surf_0[index], 0);
  347.             }
  348.     
  349.     
  350. #clearing path2
  351.         for (index = 0; index < 4; index = index + 1)
  352.             {
  353.             #Clearing sector water attributes
  354.             Setsectorlight(D2path2_sect_0[index], sect_light, 3);
  355.             Clearsectorflags(D2path2_sect_0[index], 0x2);
  356.             ClearSectorSurfFlags(D2path2_sect_0[index], 0x20000);
  357.             }
  358.  
  359.         for (index = 0; index < 8; index = index + 1)
  360.             {
  361.             #setting faces to no draw
  362.             Setfacegeomode(D2path2_surf_0[index], 0);
  363.             }
  364. return;
  365.  
  366. # ========================================================================================
  367. ClearAllDiv3:
  368.     
  369. #    tag water objects as invisible
  370. SetThingFlags(D3waterobj1, 0x10);
  371. SetThingFlags(D3waterobj2, 0x10);
  372.  
  373. #    set water sector light to nothing
  374. sect_light = VectorSet(0.0, 0.0, 0.0);
  375.     
  376. #clearing path1
  377.         for (index = 0; index < 4; index = index + 1)
  378.             {
  379.             #Clearing sector water attributes
  380.             Setsectorlight(D3path1_sect_0[index], sect_light, 3);
  381.             Clearsectorflags(D3path1_sect_0[index], 0x2);
  382.             ClearSectorSurfFlags(D3path1_sect_0[index], 0x20000);
  383.             }
  384.        
  385.         for (index = 0; index < 8; index = index + 1)
  386.             {
  387.             #setting faces to no draw
  388.             Setfacegeomode(D3path1_surf_0[index], 0);
  389.             }
  390.     
  391.     
  392. #clearing path2
  393.         for (index = 0; index < 2; index = index + 1)
  394.             {
  395.             #Clearing sector water attributes
  396.             Setsectorlight(D3path2_sect_0[index], sect_light, 3);
  397.             clearsectorflags(D3path2_sect_0[index], 0x2);
  398.             ClearSectorSurfFlags(D3path2_sect_0[index], 0x20000);
  399.             }
  400.  
  401.         for (index = 0; index < 3; index = index + 1)
  402.             {
  403.             #setting faces to no draw
  404.             Setfacegeomode(D3path2_surf_0[index], 0);
  405.             }
  406. return;
  407.  
  408.  
  409. # ========================================================================================
  410.  
  411. user0:
  412.         #the river has been thawed       
  413.         thaw = 1;
  414.                 
  415. return;
  416.  
  417. # =========================================================================
  418. user1:
  419.                
  420.         #Div1 sluice filling routine gets called       
  421.         call D1user1;
  422.         D1ambloop = PlaySoundThing(sluicesrun, D1splashpos, 0.5, 5, 10, 0x1);
  423.         D1ambloop2 = PlaySoundThing(sluicesrun, D1soundobj, 0.5, 5, 10, 0x1);
  424.         D1ambloop3 = PlaySoundThing(sluicesrun, D1soundobj2, 0.5, 5, 10, 0x1);
  425.         
  426. return;
  427.  
  428. # =========================================================================
  429. activated:
  430.  
  431.     
  432.     if (action == 1) return;
  433.     action = 1;
  434.     if (GetSenderRef() == D1lever)    #player is in DivRoom1
  435.                 {
  436.                 
  437.                 # Clear first D1lever hint
  438.                 SendMessage(hintcog, user0);
  439.                 call D1routines;
  440.                 return;
  441.                 }
  442.         if (GetSenderRef() == D2lever)    #player is in DivRoom3
  443.                 {
  444.                 # Clear hint
  445.                 SendMessage(hintcog, user1);
  446.                 
  447.                 # bring commies into play
  448.                 If (commiecreate == 0)
  449.                 {
  450.                 SendMessage(troopcog, user0);
  451.                 commiecreate = 1;
  452.                 }
  453.                 
  454.                 call D2routines;
  455.                 return;
  456.                 }
  457.         if (GetSenderRef() == D3lever)    #player is in DivRoom3
  458.                 {
  459.                 call D3routines;
  460.                 return;
  461.                 }
  462.                 
  463.         else return;
  464.                 
  465. # ........................................................................................
  466.         
  467. D1routines:        
  468.         
  469.     #Cut Scene camera
  470.     SetCameraFocus(2, D1camerapos);
  471.     SetCamerasecondaryFocus(2, D1camtarget);
  472.     ClearThingFlags(D1indy, 0x80000);
  473.     Sendmessage(camcog, user0);    #camcog makes current camera 2
  474.     ResetCameraFOV(0,0);
  475.  
  476.     # Play the lever animations - wait for Indy's
  477.     PlayKey(D1indy, in_pull, 4, 0x12, 0);
  478.     PlayKey(D1lever, lever_down, 4, 0x12, 0);
  479.     Sleep(1.0);
  480.     PlaySoundLocal(leverpull, 1.0, 0, 0x0, 0);
  481.     Sleep(1.2);
  482.     PlaySoundLocal(leverset, 0.75, 0, 0x0, 0);
  483.     Sleep(1.0);
  484.     movetoframe(D1camtarget, 1, 1.75);
  485.     movetoframe(D1camerapos, 1, 1.0);
  486.     Sleep(3.50);
  487.     geartrack=PlaySoundLocal(geargrind, 4.0, -1.0, 0x8, 0);
  488.     Sleep(0.5);
  489.     movetrack = PlaySoundLocal(bigmove, 2.0, 0, 0x0, 0);
  490.     waitforstop(D1camtarget);
  491.     SetThingFlags(D1indy, 0x80000);
  492.  
  493.  
  494.     {
  495.         if (D1position == 0)
  496.         {
  497.             if (thaw == 1)
  498.             {
  499.                 If (GetHintSolved(hint24) == 1)
  500.                     {
  501.                     SendMessage(hintcog, user2);
  502.                     # clear second Div1 hint
  503.                     }
  504.                 D1fx = 1;
  505.                 Call D1gate;        # gate anims play
  506.                 D1position = 1;
  507.                 Call D1user1;        # water levels change, water objects move
  508.                 StopSound(gatetrack, 0);
  509.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  510.                 If (rushtrack != -1)
  511.                 {
  512.                 StopSound(rushtrack, 0);    # if water noise is playing, stop it
  513.                 rushtrack = -1;
  514.                 }
  515.                 Sleep(0.5);
  516.                 MovetoFrame(D1camerapos, 0, 100);
  517.                 MovetoFrame(D1camtarget, 0, 100);
  518.                 action = 0;
  519.                 D1fx = 0;
  520.                 StopSound(geartrack, 0);
  521.                 StopSound(movetrack, 0);
  522.                 return;
  523.             }
  524.         
  525.             else
  526.             {
  527.                 Call D1gate;
  528.                 sleep(3.0);
  529.                 SetPulse(0);
  530.                 D1position = 1;
  531.                 
  532.                 StopSound(gatetrack, 0);
  533.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  534.                 If (rushtrack != -1)
  535.                 {
  536.                 StopSound(rushtrack, 0);
  537.                 rushtrack = -1;
  538.                 }
  539.  
  540.                 Sleep(1.5);
  541.                 SendMessage(camcog, user1);
  542.                 MovetoFrame(D1camerapos, 0, 100);
  543.                 MovetoFrame(D1camtarget, 0, 100);
  544.                 action = 0;
  545.                 StopSound(geartrack,0);
  546.                 StopSound(movetrack, 0);
  547.                 return;
  548.             }
  549.         }
  550.         
  551.         else if (D1position == 1)
  552.         {
  553.             if (thaw == 1)
  554.             {
  555.                 D1fx = 1;
  556.                 Call D1gate;
  557.                 D1position = 0;
  558.                 Call D1user1;
  559.  
  560.                 # ending gate move sounds
  561.                 StopSound(gatetrack, 0);
  562.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  563.                 If (rushtrack != -1)
  564.                 {
  565.                 StopSound(rushtrack, 0);
  566.                 rushtrack = -1;
  567.                 }
  568.  
  569.                 Sleep(0.5);
  570.                 MovetoFrame(D1camerapos, 0, 50);
  571.                 MovetoFrame(D1camtarget, 0, 50);
  572.                 action = 0;
  573.                 D1fx = 0;
  574.                 StopSound(geartrack,0);
  575.                 StopSound(movetrack, 0);
  576.                 return;
  577.             }
  578.  
  579.             else
  580.             {
  581.                 Call D1gate;
  582.                 sleep(3.0);
  583.                 SetPulse(0);
  584.                 D1position = 0;
  585.  
  586.                 StopSound(gatetrack, 0);
  587.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  588.                 If (rushtrack != -1)
  589.                 {
  590.                 StopSound(rushtrack, 0);
  591.                 rushtrack = -1;
  592.                 }
  593.  
  594.                 Sleep(1.5);
  595.                 SendMessage(camcog, user1);
  596.                 MovetoFrame(D1camerapos, 0, 50);
  597.                 MovetoFrame(D1camtarget, 0, 50);
  598.                 action = 0;
  599.                 StopSound(geartrack,0);
  600.                 StopSound(movetrack, 0);
  601.                 return;
  602.             }
  603.         }
  604.     }
  605.     
  606. return;
  607.  
  608. # ........................................................................................
  609. D2routines:        
  610.         
  611.     
  612.     SetCameraFocus(2, D2camerapos);
  613.     SetCamerasecondaryFocus(2, D2camtarget);
  614.     ClearThingFlags(D2indy, 0x80000);
  615.     Sendmessage(camcog, user0);
  616.     ResetCameraFOV(0,0);
  617.     
  618.     # Play the animations - wait for Indy's
  619.     
  620.     PlayKey(D2indy, in_pull, 4, 0x12, 0);
  621.     PlayKey(D2lever, lever_down, 4, 0x12, 0);
  622.     Sleep(1.0);
  623.     PlaySoundLocal(leverpull, 1.0, 0, 0x0, 0);
  624.     Sleep(1.2);
  625.     PlaySoundLocal(leverset, 0.75, 0, 0x0, 0);
  626.     Sleep(1.0);
  627.     movetoframe(D2camtarget, 1, 2);
  628.     movetoframe(D2camerapos, 1, 1.0);
  629.     Sleep(1.5);
  630.     geartrack=PlaySoundLocal(geargrind, 4.0, -1.0, 0x8, 0);
  631.     Sleep(0.5);
  632.     movetrack = PlaySoundLocal(bigmove, 2.0, 0, 0x0, 0);
  633.     waitforstop(D2camtarget);
  634.     SetThingFlags(D2indy, 0x80000);
  635.         
  636.  
  637.  
  638.     {
  639.         if (D2position == 0)
  640.         {
  641.             if (D2thaw == 1)
  642.             {
  643.                                 
  644.                 D2fx = 1;
  645.                 Call D2gate;
  646.                 D2position = 1;
  647.                 Call D2user1;
  648.  
  649.                 # ending gate move sounds
  650.                 StopSound(gatetrack, 0);
  651.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  652.                 If (rushtrack != -1)
  653.                 {
  654.                 StopSound(rushtrack, 0);
  655.                 rushtrack = -1;
  656.                 }
  657.                 
  658.                 Sleep(0.5);
  659.                 MovetoFrame(D2camerapos, 0, 50);
  660.                 MovetoFrame(D2camtarget, 0, 50);
  661.                 action = 0;
  662.                 D2fx = 0;
  663.                 StopSound(geartrack, 0);
  664.                 StopSound(movetrack, 0);
  665.                 return;
  666.             }
  667.         
  668.             else
  669.             {
  670.                 Call D2gate;
  671.                 sleep(3.0);
  672.                 SetPulse(0);
  673.                 D2position = 1;
  674.  
  675.                 StopSound(gatetrack, 0);
  676.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  677.                 If (rushtrack != -1)
  678.                 {
  679.                 StopSound(rushtrack, 0);
  680.                 rushtrack = -1;
  681.                 }
  682.  
  683.                 Sleep(1.5);
  684.                 SendMessage(camcog, user1);
  685.                 MovetoFrame(D2camerapos, 0, 50);
  686.                 MovetoFrame(D2camtarget, 0, 50);
  687.                 action = 0;
  688.                 StopSound(geartrack, 0);
  689.                 StopSound(movetrack, 0);
  690.                 return;
  691.             }
  692.         }
  693.         
  694.         else if (D2position == 1)
  695.         {
  696.             if (D2thaw == 1)
  697.             {
  698.                 D2fx = 1;
  699.                 Call D2gate;
  700.                 D2position = 0;
  701.                 Call D2user1;
  702.                 
  703.                 # stop the gate sounds and anims
  704.                 StopSound(gatetrack, 0);
  705.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  706.                 If (rushtrack != -1)
  707.                 {
  708.                 StopSound(rushtrack, 0);
  709.                 rushtrack = -1;
  710.                 }
  711.  
  712.                 Sleep(0.5);
  713.                 MovetoFrame(D2camerapos, 0, 50);
  714.                 MovetoFrame(D2camtarget, 0, 50);
  715.                 action = 0;
  716.                 D2fx = 0;
  717.                 StopSound(geartrack,0);
  718.                 StopSound(movetrack, 0);
  719.                 return;
  720.             }
  721.  
  722.             else
  723.             {
  724.                 Call D2gate;
  725.                 sleep(3.0);
  726.                 SetPulse(0);
  727.                 D2position = 0;
  728.                 
  729.                 # stop the gate sounds and anims
  730.                 StopSound(gatetrack, 0);
  731.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  732.                 If (rushtrack != -1)
  733.                 {
  734.                 StopSound(rushtrack, 0);
  735.                 rushtrack = -1;
  736.                 }
  737.                 
  738.                 Sleep(1.5);
  739.                 SendMessage(camcog, user1);
  740.                 MovetoFrame(D2camerapos, 0, 50);
  741.                 MovetoFrame(D2camtarget, 0, 50);
  742.                 action = 0;
  743.                 StopSound(geartrack,0);
  744.                 StopSound(movetrack, 0);
  745.                 return;
  746.             }
  747.         }
  748.     }
  749.     
  750. return;
  751.  
  752.  
  753. # ........................................................................................
  754.  
  755. D3routines:        
  756.         
  757.     
  758.     action = 1;    #lever cannot be hit again during scene
  759.     #StartCutscene(1);
  760.     SetCameraFocus(2, D3camerapos);
  761.     SetCamerasecondaryFocus(2, D3camtarget);
  762.     ClearThingFlags(D3indy, 0x80000);
  763.     Sendmessage(camcog, user0);
  764.     ResetCameraFOV(0,0);
  765.  
  766.     # Play the animations - wait for Indy's
  767.     
  768.     PlayKey(D3indy, in_pull, 4, 0x12, 0);
  769.     PlayKey(D3lever, lever_down, 4, 0x12, 0);
  770.     Sleep(1.0);
  771.     PlaySoundLocal(leverpull, 1.0, 0, 0x0, 0);
  772.     Sleep(1.2);
  773.     PlaySoundLocal(leverset, 0.75, 0, 0x0, 0);
  774.     Sleep(1.0);
  775.     movetoframe(D3camtarget, 1, 15);
  776.     movetoframe(D3camerapos, 1, 10);
  777.     Sleep(3.5);
  778.     geartrack=PlaySoundLocal(geargrind, 4.0, -1.0, 0x8, 0);
  779.     Sleep(0.5);
  780.     waitforstop(D3camerapos);
  781.     SetThingFlags(D3indy, 0x80000);
  782.         
  783.  
  784. if (D3position == 0)
  785.     {
  786.         if (D3thaw == 1)
  787.             {
  788.                 D3fx = 1;
  789.                 Call D3gate;
  790.                 D3position = 1;
  791.                 Call D3user1;
  792.                 sleep(2.5);
  793.  
  794.                 # ending gate move sounds
  795.                 StopSound(gatetrack, 0);
  796.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  797.                 If (rushtrack != -1)
  798.                 {
  799.                 StopSound(rushtrack, 0);
  800.                 rushtrack = -1;
  801.                 }
  802.  
  803.                 MovetoFrame(D3camerapos, 0, 50);
  804.                 MovetoFrame(D3camtarget, 0, 50);
  805.                 Sleep(0.25);
  806.                 action = 0;
  807.                 D3fx = 0;
  808.                 StopSound(geartrack, 0);
  809.                 StopSound(movetrack, 0);
  810.                 return;
  811.             }
  812.         
  813.         else
  814.             {
  815.                 Call D3gate;
  816.                 sleep(3.0);
  817.                 D3position = 1;
  818.  
  819.                 StopSound(gatetrack, 0);
  820.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  821.                 If (rushtrack != -1)
  822.                 {
  823.                 StopSound(rushtrack, 0);
  824.                 rushtrack = -1;
  825.                 }
  826.  
  827.                 SetPulse(0);
  828.                 Sleep(1.5);
  829.                 Sendmessage(camcog, user1);
  830.                 MovetoFrame(D3camerapos, 0, 50);
  831.                 MovetoFrame(D3camtarget, 0, 50);
  832.                 action = 0;
  833.                 D3fx = 0;
  834.                 StopSound(geartrack, 0);
  835.                 StopSound(movetrack, 0);
  836.                 return;
  837.             }
  838.     }
  839.         
  840. else if (D3position == 1)
  841.     {
  842.         if (D3thaw == 1)
  843.             {
  844.                 D3fx = 1;
  845.                 Call D3gate;
  846.                 D3position = 0;
  847.                 Call D3user1;
  848.                 
  849.                 StopSound(gatetrack, 0);
  850.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  851.                 If (rushtrack != -1)
  852.                 {
  853.                 StopSound(rushtrack, 0);
  854.                 rushtrack = -1;
  855.                 }
  856.  
  857.                 MovetoFrame(D3camerapos, 0, 50);
  858.                 MovetoFrame(D3camtarget, 0, 50);
  859.                 Sleep(0.25);
  860.                 action = 0;
  861.                 D3fx = 0;
  862.                 StopSound(geartrack,0);
  863.                 StopSound(movetrack, 0);
  864.                 return;
  865.             }
  866.  
  867.         else
  868.             {
  869.                 Call D3gate;
  870.                 sleep(3.0);
  871.                 D3position = 0;
  872.  
  873.                 StopSound(gatetrack, 0);
  874.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  875.                 If (rushtrack != -1)
  876.                 {
  877.                 StopSound(rushtrack, 0);
  878.                 rushtrack = -1;
  879.                 }
  880.                 
  881.                 SetPulse(0);
  882.                 Sleep(1.5);
  883.                 Sendmessage(camcog, user1);
  884.                 MovetoFrame(D3camerapos, 0, 50);
  885.                 MovetoFrame(D3camtarget, 0, 50);
  886.                 action = 0;
  887.                 D3fx = 0;
  888.                 StopSound(geartrack,0);
  889.                 StopSound(movetrack, 0);
  890.                 return;
  891.             }
  892.     }
  893.  
  894.     
  895. return;
  896.  
  897. # ........................................................................................
  898. D1user1:
  899.  
  900. If (D1position == 1)    #from Div3 to Div2
  901.     {
  902.             
  903.             Rotate(D1waterobj2, 90, 2, 0.01);           #exp angle
  904.             Sleep(.01);
  905.             ClearThingFlags(D1waterobj2, 0x10);
  906.             Rotate(D1waterobj2, -90, 2, 3.5);
  907.             
  908.             ClearThingFlags(D1waterobj1, 0x10);
  909.             
  910.             
  911.             
  912. #clear path1 sector physics, sector light, & sector surf flags
  913.             sect_light = VectorSet(0.0, 0.0, 0.0);
  914.         
  915.     for (index = 0; index < 13; index = index + 1)
  916.             {
  917.             clearsectorflags(D1path1_sect_0[index], 0x2);
  918.             ClearSectorSurfFlags(D1path1_sect_0[index], 0x20000);
  919.             setsectorlight(D1path1_sect_0[index], sect_light, 3);
  920.             }
  921.  
  922. #no draw path1 sector faces
  923.         
  924.         for (index = 0; index < 26; index = index + 1)
  925.             {
  926.             setfacegeomode(D1path1_surf_0[index], 0);
  927.             }
  928.             
  929.             Rotate(D1waterobj1, -90, 0, 2.5);
  930.             
  931.             WaitForStop(D1waterobj2);
  932.  
  933.  
  934.  
  935. # set path2 sectors to h2O & set sector light
  936.             sect_light = VectorSet(0.0, 0.5, 1.0);
  937.  
  938.         for (index = 0; index < 1; index = index + 1)
  939.             {
  940.             setsectorflags(D1path2_sect_0[index], 0x2);
  941.             setsectorlight(D1path2_sect_0[index], sect_light, 3);
  942.             SetSectorSurfFlags(D1path2_sect_0[index], 0x20000);
  943.             }
  944.  
  945. #set path2 faces to draw & set faces to full light
  946.         for (index = 0; index < 2; index = index + 1)
  947.             {
  948.             setfacegeomode(D1path2_surf_0[index], 4);
  949.             setfacelightmode(D1path2_surf_0[index], 0);
  950.             }
  951.             
  952.             # reset D1waterobj1
  953.             SetThingFlags(D1waterobj1, 0x10);
  954.             CopyOrientAndPos(D1H2Ohome1, D1waterobj1); 
  955.             # reset D1waterobj2
  956.             SetThingFlags(D1waterobj2, 0x10);
  957.             CopyOrientAndPos(D1H2Ohome2, D1waterobj2); 
  958.             
  959.  
  960.             SetPulse(0);
  961.             Sleep(0.5);
  962.             D2thaw = 1;
  963.             D3thaw = 0;
  964.             
  965.             # fill D2 sluices with water
  966.             call D2turbolevels;
  967.             # start D2 room sound loop
  968.             D2ambloop = PlaySoundThing(sluicesrun, D2splashpos, 0.5, 5, 10, 0x1);
  969.             D2ambloop2 = PlaySoundThing(sluicesrun, D2soundobj, 0.5, 5, 10, 0x1);
  970.             D2ambloop3 = PlaySoundThing(sluicesrun, D2soundobj2, 0.5, 5, 10, 0x1);
  971.             
  972.             call ClearAllDiv3;
  973.             If (D3ambloop != -1)
  974.                 {
  975.                 StopSound(D3ambloop);
  976.                 }
  977.  
  978. #send message to next cogs
  979.             
  980.             Sendmessage(bucketcog,user1);
  981.             Sendmessage(hammercamcog,user1);
  982.             #Sendmessage(Portcog,user0);
  983. return;    
  984.     }
  985.  
  986.  
  987. else If (D1position == 0)    #from Div2 to Div3
  988.     {
  989.  
  990.             # fill sluice 1
  991.             Rotate(D1waterobj1, -90, 0, 0.01);         #exp angle
  992.             Sleep(.01);
  993.             ClearThingFlags(D1waterobj1, 0x10);
  994.             Rotate(D1waterobj1, 90, 0, 3.5);
  995.             # empty sluice 2
  996.             ClearThingFlags(D1waterobj2, 0x10);
  997.             
  998.             
  999. #clear path2 sector h2o physics, sector lights, sect surf flags
  1000.             sect_light = VectorSet(0.0, 0.0, 0.0);
  1001.  
  1002.         for (index = 0; index < 1; index = index + 1)
  1003.             {
  1004.             clearsectorflags(D1path2_sect_0[index], 0x2);
  1005.             ClearSectorSurfFlags(D1path2_sect_0[index], 0x20000);
  1006.             setsectorlight(D1path2_sect_0[index], sect_light, 3);
  1007.             }
  1008. #no draw path2 sector faces
  1009.         
  1010.         for (index = 0; index < 2; index = index + 1)
  1011.             {
  1012.             setfacegeomode(D1path2_surf_0[index], 0);
  1013.             }
  1014.            
  1015.             Rotate(D1waterobj2, 90, 2, 3.0);
  1016.             waitforstop(D1waterobj1);
  1017.  
  1018.  
  1019. # set path1 sectors to h2O & set light
  1020.             sect_light = VectorSet(0.0, 0.5, 1.0);
  1021.  
  1022.         for (index = 0; index < 13; index = index + 1)
  1023.             {
  1024.             setsectorflags(D1path1_sect_0[index], 0x2);
  1025.             setsectorlight(D1path1_sect_0[index], sect_light, 3);
  1026.             SetSectorSurfFlags(D1path1_sect_0[index], 0x20000);
  1027.             }
  1028. #set path1 faces to draw & set faces to full light
  1029.         for (index = 0; index < 26; index = index + 1)
  1030.             {
  1031.             setfacegeomode(D1path1_surf_0[index], 4);
  1032.             setfacelightmode(D1path1_surf_0[index], 0);
  1033.             }
  1034.             
  1035.             # reset D1waterobj1
  1036.             SetThingFlags(D1waterobj1, 0x10);
  1037.             CopyOrientAndPos(D1H2Ohome1, D1waterobj1); 
  1038.             # reset D1waterobj2
  1039.             SetThingFlags(D1waterobj2, 0x10);
  1040.             CopyOrientAndPos(D1H2Ohome2, D1waterobj2); 
  1041.             
  1042.             SetPulse(0);
  1043.             # set water state variables
  1044.             D2thaw = 0;
  1045.             D3thaw = 1;
  1046.             # set next room sluice states
  1047.             call D3turbolevels;
  1048.             # start D3 room sound loop
  1049.             D3ambloop = PlaySoundThing(sluicesrun, D3splashpos, 0.5, 5, 10, 0x1);
  1050.             
  1051.             call ClearAllDiv2;
  1052.             If (D2ambloop != -1)
  1053.                 {
  1054.                 StopSound(D2ambloop);
  1055.                 StopSound(D2ambloop2);
  1056.                 StopSound(D2ambloop3);
  1057.                 }
  1058.  
  1059.  
  1060. #send message to next cogs
  1061.             Sendmessage(bucketcog,user0);
  1062.             Sendmessage(hammercamcog,user0);
  1063.             #Sendmessage(Portcog,user1);
  1064.  
  1065.     }    
  1066. return;
  1067.  
  1068. # =========================================================================    
  1069. D2user1:
  1070.  
  1071.     if (D2position == 1)
  1072.     {
  1073.                
  1074.                
  1075.             Rotate(D2waterobj2, 90, 2, 0.01);           #exp angle
  1076.             Sleep(.01);
  1077.             ClearThingFlags(D2waterobj2, 0x10);
  1078.             Rotate(D2waterobj2, -90, 2, 3.5);
  1079.             
  1080.             ClearThingFlags(D2waterobj1, 0x10);
  1081.          
  1082. #clear path1 sectors of h2O
  1083.             sect_light = VectorSet(0.0, 0.0, 0.0);
  1084.         
  1085.         for (index = 0; index < 3; index = index + 1)
  1086.             {
  1087.             ###print("D2user1 path1 sectors cleared");
  1088.             clearsectorflags(D2path1_sect_0[index], 0x2);
  1089.             ClearSectorSurfFlags(D2path1_sect_0[index], 0x20000);
  1090.             setsectorlight(D2path1_sect_0[index], sect_light, 3);
  1091.             }
  1092.  
  1093. #no draw opposing sector faces
  1094.         for (index = 0; index < 6; index = index + 1)
  1095.             {
  1096.             setfacegeomode(D2path1_surf_0[index], 0);
  1097.             }
  1098.             
  1099.             Rotate(D2waterobj1, -90, 0, 2.5);
  1100.             waitforstop(D2waterobj2);
  1101.                 
  1102. # set path2 sectors to h2O & set sector light
  1103.             sect_light = VectorSet(0.0, 0.5, 1.0);
  1104.  
  1105.         for (index = 0; index < 4; index = index + 1)
  1106.             {
  1107.             setsectorflags(D2path2_sect_0[index], 0x2);
  1108.             setsectorlight(D2path2_sect_0[index], sect_light, 3);
  1109.             SetSectorSurfFlags(D2path2_sect_0[index], 0x20000);
  1110.             }
  1111.  
  1112. #set faces to draw & set faces to full light
  1113.         for (index = 0; index < 8; index = index + 1)
  1114.             {
  1115.             setfacegeomode(D2path2_surf_0[index], 4);
  1116.             setfacelightmode(D2path2_surf_0[index], 0);
  1117.             }
  1118.                 
  1119.             # reset D1waterobj1
  1120.             SetThingFlags(D2waterobj1, 0x10);
  1121.             CopyOrientAndPos(D2H2Ohome1, D2waterobj1); 
  1122.             # reset D1waterobj2
  1123.             SetThingFlags(D2waterobj2, 0x10);
  1124.             CopyOrientAndPos(D2H2Ohome2, D2waterobj2);
  1125.  
  1126.  
  1127.             SetPulse(0);
  1128.             Sleep(1.0);
  1129.                 
  1130. #send message to next cogs
  1131.             sendmessage(Sluicecog2, user2);
  1132.             sendmessage(Sluicecog1, user0);
  1133.             Sleep(.1);
  1134.             sendmessage(Powerdoorcog, user0);
  1135.         }
  1136.     
  1137.     else
  1138.     
  1139.         {
  1140.                 
  1141.                 
  1142.             # fill sluice 1
  1143.             Rotate(D2waterobj1, -90, 0, 0.01);         #exp angle
  1144.             Sleep(.01);
  1145.             ClearThingFlags(D2waterobj1, 0x10);
  1146.             Rotate(D2waterobj1, 90, 0, 3.5);
  1147.             
  1148.             # empty sluice 2
  1149.             ClearThingFlags(D2waterobj2, 0x10);
  1150.                 
  1151.                 
  1152. #clear path2 sectors of h2O clear path2 sector lights
  1153.             sect_light = VectorSet(0.0, 0.0, 0.0);
  1154.  
  1155.         for (index = 0; index < 4; index = index + 1)
  1156.             {
  1157.             clearsectorflags(D2path2_sect_0[index], 0x2);
  1158.             ClearSectorSurfFlags(D2path2_sect_0[index], 0x20000);
  1159.             setsectorlight(D2path2_sect_0[index], sect_light, 3);
  1160.             }
  1161.  
  1162. #no draw opposing sector faces
  1163.         
  1164.         for (index = 0; index < 8; index = index + 1)
  1165.             {
  1166.             setfacegeomode(D2path2_surf_0[index], 0);
  1167.             }
  1168.             
  1169.             Rotate(D2waterobj2, 90, 2, 3.0);
  1170.             waitforstop(D2waterobj1);
  1171.                 
  1172. # set path1 sectors to h2O & set sector light
  1173.             sect_light = VectorSet(0.0, 0.5, 1.0);
  1174.         
  1175.         for (index = 0; index < 3; index = index + 1)
  1176.             {
  1177.             ###print("D2user1 path1 sectors lit");
  1178.             setsectorflags(D2path1_sect_0[index], 0x2);
  1179.             setsectorlight(D2path1_sect_0[index], sect_light, 3);
  1180.             }
  1181.  
  1182. #set faces to draw & set faces to full light
  1183.  
  1184.         for (index = 0; index < 6; index = index + 1)
  1185.             {
  1186.             setfacegeomode(D2path1_surf_0[index], 4);
  1187.             setfacelightmode(D2path1_surf_0[index], 0);
  1188.             }
  1189.                 
  1190.             # reset D1waterobj1
  1191.             SetThingFlags(D2waterobj1, 0x10);
  1192.             CopyOrientAndPos(D2H2Ohome1, D2waterobj1); 
  1193.             # reset D1waterobj2
  1194.             SetThingFlags(D2waterobj2, 0x10);
  1195.             CopyOrientAndPos(D2H2Ohome2, D2waterobj2); 
  1196.             
  1197.             # stop screenshake
  1198.             SetPulse(0);
  1199.             Sleep(1.0);
  1200.                 
  1201. #send message to next cogs
  1202.             sendmessage(Sluicecog2, user1);
  1203.             sendmessage(Sluicecog1, user0);
  1204.             Sleep(.1);
  1205.             sendmessage(Powerdoorcog, user0);
  1206.                 
  1207.         
  1208.     }
  1209. return;
  1210.  
  1211. # =========================================================================
  1212. D3user1:    
  1213.     
  1214.     if (D3position == 0)
  1215.     {
  1216.         
  1217.         Rotate(D3waterobj1, -90, 0, 0.01);       
  1218.         Sleep(.01);
  1219.         ClearThingFlags(D3waterobj1, 0x10);
  1220.         Rotate(D3waterobj1, 90, 0, 3);        
  1221.         
  1222.         ClearThingFlags(D3waterobj2, 0x10);
  1223.         
  1224.         #clear opposing sectors of h2O clear opposing sector lights
  1225.                 sect_light = VectorSet(0.0, 0.0, 0.0);
  1226.  
  1227.         for (index = 0; index < 2; index = index + 1)
  1228.                 {
  1229.                 ###print("D3user1 path2 sectors clearing");
  1230.                 clearsectorflags(D3path2_sect_0[index], 0x2);
  1231.                 ClearSectorSurfFlags(D3path2_sect_0[index], 0x20000);
  1232.                 setsectorlight(D3path2_sect_0[index], sect_light, 3);
  1233.                 }
  1234.  
  1235. #no draw opposing sector faces
  1236.         
  1237.         for (index = 0; index < 3; index = index + 1)
  1238.                 {
  1239.                 ###print("D3user1 path2 geomodes clearing");
  1240.                 setfacegeomode(D3path2_surf_0[index], 0);
  1241.                 }        
  1242.     
  1243.                 Rotate(D3waterobj2, 90, 2, 3);
  1244.                 waitforstop(D3waterobj1);
  1245.         
  1246.                 
  1247. # set sectors to h2O & set sector light
  1248.                 sect_light = VectorSet(0.0, 0.5, 1.0);
  1249.         
  1250.         for (index = 0; index < 4; index = index + 1)
  1251.                 {
  1252.                 ###print("D3user1 path1 sectors lit");
  1253.                 setsectorflags(D3path1_sect_0[index], 0x2);
  1254.                 setsectorlight(D3path1_sect_0[index], sect_light, 3);
  1255.                 }
  1256.  
  1257. #set faces to draw & set faces to full light
  1258.  
  1259.         for (index = 0; index < 8; index = index + 1)
  1260.                 {
  1261.                 ###print("D3user1 path1 geomodes drawn/lit");
  1262.                 setfacegeomode(D3path1_surf_0[index], 4);
  1263.                 setfacelightmode(D3path1_surf_0[index], 0);
  1264.                 }
  1265.                 
  1266.                 SetThingFlags(D3waterobj1, 0x10);
  1267.                 CopyOrientAndPos(D3H2Ohome1, D3waterobj1); 
  1268.                 
  1269.  
  1270.                 SetThingFlags(D3waterobj2, 0x10);
  1271.                 CopyOrientAndPos(D3H2Ohome2, D3waterobj2); 
  1272.                 
  1273.  
  1274.                 SetPulse(0);
  1275.                 Sleep(.5);
  1276.  
  1277. #send message to next cogs
  1278.                 
  1279.                 
  1280.                 sendmessage(Sluicecog1, user2);
  1281.                 sendmessage(Sluicecog2, user0);
  1282.                 Sleep(0.5);
  1283.                 sendmessage(Powerdoorcog, user0);
  1284.                 
  1285. return;
  1286.     }
  1287.     
  1288.     else
  1289.     {
  1290.  
  1291.         Rotate(D3waterobj2, 90, 2, 0.01);      
  1292.         Sleep(.01);
  1293.         ClearThingFlags(D3waterobj2, 0x10);
  1294.         Rotate(D3waterobj2, -90, 2, 3);        
  1295.         
  1296.         ClearThingFlags(D3waterobj1, 0x10);
  1297.         
  1298.         #clear opposing sectors of h2O
  1299.                 sect_light = VectorSet(0.0, 0.0, 0.0);
  1300.         
  1301.         for (index = 0; index < 4; index = index + 1)
  1302.                 {
  1303.                 ###print("D3user1 path1 sectors clearing");
  1304.                 clearsectorflags(D3path1_sect_0[index], 0x2);
  1305.                 ClearSectorSurfFlags(D3path1_sect_0[index], 0x20000);
  1306.                 setsectorlight(D3path1_sect_0[index], sect_light, 3);
  1307.                 }
  1308.  
  1309.         #no draw opposing sector faces
  1310.         
  1311.         for (index = 0; index < 8; index = index + 1)
  1312.                 {
  1313.                 ###print("D3user1 path1 geomodes clearing");
  1314.                 setfacegeomode(D3path1_surf_0[index], 0);
  1315.                 }        
  1316.  
  1317.                 Rotate(D3waterobj1, -90, 0, 3);
  1318.                 waitforstop(D3waterobj2);
  1319.                 
  1320.  
  1321. # set path2 sectors to h2O & set sector light
  1322.                 sect_light = VectorSet(0.0, 0.5, 1.0);
  1323.  
  1324.         for (index = 0; index < 2; index = index + 1)
  1325.                 {
  1326.                 ###print("D3user1 path2 sectors lit");
  1327.                 setsectorflags(D3path2_sect_0[index], 0x2);
  1328.                 setsectorlight(D3path2_sect_0[index], sect_light, 3);
  1329.                 }
  1330.  
  1331. #set path2 faces to draw & set faces to full light
  1332.         for (index = 0; index < 3; index = index + 1)
  1333.                 {
  1334.                 ###print("D3user1 path1 geomodes drawn/lit");
  1335.                 setfacegeomode(D3path2_surf_0[index], 4);
  1336.                 setfacelightmode(D3path2_surf_0[index], 0);
  1337.                 }
  1338.  
  1339.                 SetThingFlags(D3waterobj1, 0x10);
  1340.                 CopyOrientAndPos(D3H2Ohome1, D3waterobj1); 
  1341.                 
  1342.                 SetThingFlags(D3waterobj2, 0x10);
  1343.                 CopyOrientAndPos(D3H2Ohome2, D3waterobj2); 
  1344.                 
  1345.  
  1346.                 SetPulse(0);
  1347.                 Sleep(1.5);
  1348.                 
  1349. #send message to next cogs
  1350.                 sendmessage(Sluicecog1, user1);
  1351.                 sendmessage(Sluicecog2, user0);
  1352.                 sleep(.1);
  1353.                 sendmessage(Powerdoorcog, user0);
  1354.                 
  1355.     }
  1356.     return;
  1357.  
  1358. # =========================================================================
  1359.  
  1360. backtocamscript:
  1361.  
  1362.            ClearThingFlags(player, 0x80000);
  1363.            
  1364.            action=0;
  1365.            EndCutscene();
  1366. return;
  1367.  
  1368. #=======================================================================
  1369. D1gate:
  1370.  
  1371.         
  1372.         SetPulse(0.1);
  1373.         PlaySoundLocal(gatestart, 1, 0, 0x0, 0);
  1374.         Sleep(.25);
  1375.         gatetrack = PlaySoundThing(gaterun, D1sluice0, 1.0, 0, 20, 0);
  1376.  
  1377.         If (thaw == 1)
  1378.             {
  1379.                 rushtrack = PlaySoundLocal(waterrush, 1, 1, 0x1, 0);
  1380.             }
  1381.         If (D1position == 0)
  1382.             {
  1383.                 If (D1sluicemove1 != -1)
  1384.                     {
  1385.                     StopKey(D1sluice0, D1sluicemove1, 0);
  1386.                     D1sluicemove1 = -1;
  1387.                     }
  1388.                 D1sluicemove = PlayKey(D1sluice0, sluice_open, 2, 0x04, 0);
  1389.             
  1390.             }
  1391.  
  1392.         If (D1position ==1)
  1393.                 {
  1394.                 If (D1sluicemove != -1)
  1395.                     {
  1396.                     StopKey(D1sluice0, D1sluicemove, 0);
  1397.                     D1sluicemove = -1;
  1398.                     }
  1399.                 D1sluicemove1 = PlayKey(D1sluice0, sluice_close, 4, 0x04, 0);
  1400.             
  1401.                 }
  1402.         
  1403.                 
  1404. return;
  1405.  
  1406. #=======================================================================
  1407. D2gate:
  1408.  
  1409.         SetPulse(0.1);
  1410.         PlaySoundLocal(gatestart, 1, 0, 0x0, 0);
  1411.         Sleep(.25);
  1412.         gatetrack = PlaySoundThing(gaterun, D1sluice0, 1.0, 0, 20, 0); 
  1413.  
  1414.         If (D2thaw == 1)
  1415.             {
  1416.                 rushtrack = PlaySoundLocal(waterrush, 1, 1, 0x1, 0);
  1417.             }
  1418.         If (D2position == 0)
  1419.                 {
  1420.                 If (D2sluicemove1 != -1)
  1421.                         {
  1422.                         StopKey(D2sluice0, D2sluicemove1, 0);
  1423.                         D2sluicemove1 = -1;
  1424.                         }
  1425.                 D2sluicemove = PlayKey(D2sluice0, sluice2_open, 2, 0x04, 0);
  1426.                 return;
  1427.                 }
  1428.  
  1429.         If (D2position ==1)
  1430.                 {
  1431.                 If (D2sluicemove != -1)
  1432.                         {
  1433.                         StopKey(D2sluice0, D2sluicemove, 0);
  1434.                         D2sluicemove = -1;
  1435.                         }
  1436.                 D2sluicemove1 = PlayKey(D2sluice0, sluice2_close, 4, 0x04, 0);
  1437.                 return;
  1438.                 }
  1439.                 
  1440. return;
  1441.  
  1442. #=======================================================================
  1443. D3gate:
  1444.  
  1445. SetPulse(0.1);
  1446. PlaySoundLocal(gatestart, 1, 0, 0x0, 0);
  1447. Sleep(.25);
  1448. gatetrack = PlaySoundThing(gaterun, D3sluice0, 1.0, 0, 20, 0); 
  1449.  
  1450. If (D3thaw == 1)
  1451.     {
  1452.        rushtrack = PlaySoundLocal(waterrush, 1, 1, 0x1, 0);
  1453.     }
  1454.  
  1455. If (D3position == 0)
  1456.     {
  1457.     If (D3sluicemove1 != -1)
  1458.         {
  1459.         StopKey(D3sluice0, D3sluicemove1, 0);
  1460.         D3sluicemove1 = -1;
  1461.         }
  1462.         D3sluicemove = PlayKey(D3sluice0, sluice_open, 2, 0x04, 0);
  1463.     return;
  1464.     }
  1465.  
  1466. If (D3position == 1)
  1467.     {
  1468.     If (D3sluicemove != -1)
  1469.         {
  1470.         StopKey(D3sluice0, D3sluicemove, 0);
  1471.         D3sluicemove = -1;
  1472.         }
  1473.         D3sluicemove1 = PlayKey(D3sluice0, sluice_close, 4, 0x04, 0);
  1474.     return;
  1475.     }
  1476.                 
  1477. return;
  1478.  
  1479.  
  1480. #=======================================================================
  1481. D2turbolevels:
  1482.     
  1483.     ###print("D2turbolevels starting...");
  1484. if (D2position == 1)
  1485.     {
  1486.      
  1487. #send message to next cogs
  1488.                 ###print("water to sluice3 , clearing sluice4");
  1489.                 sendmessage(Sluicecog2, user2);
  1490.                 sendmessage(Sluicecog1, user0);
  1491.                 Sleep(.1);
  1492.                 sendmessage(Powerdoorcog, user0);
  1493.          
  1494. #clear path1 sectors of h2O
  1495.                 sect_light = VectorSet(0.0, 0.0, 0.0);
  1496.         
  1497.         for (index = 0; index < 3; index = index + 1)
  1498.                 {
  1499.                 ###print("D2turbolvls path1 sectors clearing");
  1500.                 clearsectorflags(D2path1_sect_0[index], 0x2);
  1501.                 ClearSectorSurfFlags(D2path1_sect_0[index], 0x20000);
  1502.                 setsectorlight(D2path1_sect_0[index], sect_light, 3);
  1503.                 }
  1504.  
  1505. #no draw opposing sector faces
  1506.         for (index = 0; index < 6; index = index + 1)
  1507.                 {
  1508.                 ###print("D2turbolvls path1 geomodes clearing");
  1509.                 setfacegeomode(D2path1_surf_0[index], 0);
  1510.                 }
  1511.                 
  1512.                 
  1513. # set path2 sectors to h2O & set sector light
  1514.                 sect_light = VectorSet(0.0, 0.5, 1.0);
  1515.  
  1516.         for (index = 0; index < 4; index = index + 1)
  1517.                 {
  1518.                 ###print("D2turbolvls path2 sectors lit");
  1519.                 setsectorflags(D2path2_sect_0[index], 0x2);
  1520.                 setsectorlight(D2path2_sect_0[index], sect_light, 3);
  1521.                 }
  1522.  
  1523. #set faces to draw & set faces to full light
  1524.         for (index = 0; index < 8; index = index + 1)
  1525.                 {
  1526.                 ###print("D2turbolvls path2 geomodes drawn/lit");
  1527.                 setfacegeomode(D2path2_surf_0[index], 4);
  1528.                 setfacelightmode(D2path2_surf_0[index], 0);
  1529.                 }
  1530.         }
  1531.     
  1532.     else
  1533.     
  1534.         {
  1535. #send message to next cogs
  1536.                 ###print("water to sluice4 , clearing sluice3");
  1537.                 sendmessage(Sluicecog2, user1);
  1538.                 sendmessage(Sluicecog1, user0);
  1539.                 Sleep(.1);
  1540.                 sendmessage(Powerdoorcog, user0);
  1541.                 
  1542. #clear path2 sectors of h2O clear path2 sector lights
  1543.                 sect_light = VectorSet(0.0, 0.0, 0.0);
  1544.  
  1545.         for (index = 0; index < 4; index = index + 1)
  1546.                 {
  1547.                 ###print("D2turbolvls path2 sectors cleared");
  1548.                 clearsectorflags(D2path2_sect_0[index], 0x2);
  1549.                 ClearSectorSurfFlags(D2path2_sect_0[index], 0x20000);
  1550.                 setsectorlight(D2path2_sect_0[index], sect_light, 3);
  1551.                 }
  1552.  
  1553. #no draw path2  faces
  1554.         
  1555.         for (index = 0; index < 8; index = index + 1)
  1556.                 {
  1557.                 ###print("D2turbolvls path2 gemodes cleared");
  1558.                 setfacegeomode(D2path2_surf_0[index], 0);
  1559.                 }
  1560.                 
  1561. # set path1 sectors to h2O & set sector light
  1562.                 sect_light = VectorSet(0.0, 0.5, 1.0);
  1563.         
  1564.         for (index = 0; index < 3; index = index + 1)
  1565.                 {
  1566.                 ###print("D2turbolvls path1 sectors lit");
  1567.                 setsectorflags(D2path1_sect_0[index], 0x2);
  1568.                 setsectorlight(D2path1_sect_0[index], sect_light, 3);
  1569.                 }
  1570.  
  1571. #set path1 faces to draw & set faces to full light
  1572.  
  1573.         for (index = 0; index < 6; index = index + 1)
  1574.                 {
  1575.                 ###print("D2turbolvls path1 gemodes drawn/lit");
  1576.                 setfacegeomode(D2path1_surf_0[index], 4);
  1577.                 setfacelightmode(D2path1_surf_0[index], 0);
  1578.                 }
  1579.     }
  1580. return;
  1581.  
  1582. #=======================================================================
  1583. D3turbolevels:
  1584.     ###print("D3turbolevels starting...");
  1585. if (D3position == 1)
  1586.     {
  1587.      
  1588. #send message to next cogs
  1589.                 ###print("water to sluice1 , clearing sluice2");
  1590.                 sendmessage(Sluicecog1, user1);
  1591.                 sendmessage(Sluicecog2, user0);
  1592.                 Sleep(.1);
  1593.                 sendmessage(Powerdoorcog, user0);
  1594.          
  1595. #clear path1 sectors of h2O
  1596.                 sect_light = VectorSet(0.0, 0.0, 0.0);
  1597.         
  1598.         for (index = 0; index < 4; index = index + 1)
  1599.                 {
  1600.                 ###print("D3turbolvls path1 sectors cleared");
  1601.                 clearsectorflags(D3path1_sect_0[index], 0x2);
  1602.                 ClearSectorSurfFlags(D3path1_sect_0[index], 0x20000);
  1603.                 setsectorlight(D3path1_sect_0[index], sect_light, 3);
  1604.                 }
  1605.  
  1606. #no draw opposing sector faces
  1607.         for (index = 0; index < 8; index = index + 1)
  1608.                 {
  1609.                 ###print("D3turbolvls path1 geomodes cleared");
  1610.                 setfacegeomode(D3path1_surf_0[index], 0);
  1611.                 }
  1612.                 
  1613.                 
  1614. # set path2 sectors to h2O & set sector light
  1615.                 sect_light = VectorSet(0.0, 0.5, 1.0);
  1616.  
  1617.         for (index = 0; index < 2; index = index + 1)
  1618.                 {
  1619.                 ###print("D3turbolvls path2 sectors lit");
  1620.                 setsectorflags(D3path2_sect_0[index], 0x2);
  1621.                 setsectorlight(D3path2_sect_0[index], sect_light, 3);
  1622.                 }
  1623.  
  1624.         #set faces to draw & set faces to full light
  1625.         for (index = 0; index < 3; index = index + 1)
  1626.                 {
  1627.                 ###print("D3turbolvls path2 geomodes drawn/lit");
  1628.                 setfacegeomode(D3path2_surf_0[index], 4);
  1629.                 setfacelightmode(D3path2_surf_0[index], 0);
  1630.                 }
  1631.         }
  1632.     
  1633.     else
  1634.     
  1635.         {
  1636. #send message to next cogs
  1637.     ###print("water to sluice2 , clearing sluice1");
  1638.     sendmessage(Sluicecog1, user2);
  1639.     sendmessage(Sluicecog2, user0);
  1640.     Sleep(.5);
  1641.     sendmessage(Powerdoorcog, user0);
  1642.                 
  1643. #clear path2 sectors of h2O clear path2 sector lights
  1644.                 sect_light = VectorSet(0.0, 0.0, 0.0);
  1645.  
  1646.         for (index = 0; index < 2; index = index + 1)
  1647.                 {
  1648.                 ###print("D3turbolvls path2 sectors cleared");
  1649.                 clearsectorflags(D3path2_sect_0[index], 0x2);
  1650.                 ClearSectorSurfFlags(D3path2_sect_0[index], 0x20000);
  1651.                 setsectorlight(D3path2_sect_0[index], sect_light, 3);
  1652.                 }
  1653.  
  1654. #no draw opposing sector faces
  1655.         
  1656.         for (index = 0; index < 3; index = index + 1)
  1657.                 {
  1658.                 ###print("D3turbolvls path2 geomodes cleared");
  1659.                 setfacegeomode(D3path2_surf_0[index], 0);
  1660.                 }
  1661.                 
  1662.  # set path1 sectors to h2O & set sector light
  1663.                 sect_light = VectorSet(0.0, 0.5, 1.0);
  1664.         
  1665.         for (index = 0; index < 4; index = index + 1)
  1666.                 {
  1667.                 ###print("D3turbolvls path1 sectors cleared");
  1668.                 setsectorflags(D3path1_sect_0[index], 0x2);
  1669.                 setsectorlight(D3path1_sect_0[index], sect_light, 3);
  1670.                 }
  1671.  
  1672. #set faces to draw & set faces to full light
  1673.  
  1674.         for (index = 0; index < 8; index = index + 1)
  1675.                 {
  1676.                 ###print("D3turbolvls path1 geomodes drawn/lit");
  1677.                 setfacegeomode(D3path1_surf_0[index], 4);
  1678.                 setfacelightmode(D3path1_surf_0[index], 0);
  1679.                 }
  1680.         }
  1681. return;
  1682.  
  1683.  
  1684. #=======================================================================
  1685. pulse:
  1686.  
  1687.     SetPOVShake('0.0 0.0 0.01', '0.0 0.0 0.0', 0.80, 80.0);
  1688.     If (D1fx == 1)
  1689.         {
  1690.         splashitem = CreateThing(splash, D1splashpos);
  1691.         }
  1692.     
  1693.     If (D2fx == 1)
  1694.         {
  1695.         splashitem = CreateThing(splash, D2splashpos);
  1696.         }
  1697.  
  1698.     If (D3fx == 1)
  1699.         {
  1700.         splashitem = CreateThing(splash, D3splashpos);
  1701.         }
  1702.     
  1703.     
  1704. return;
  1705.  
  1706. #=======================================================================
  1707.  
  1708.  
  1709. end
  1710.  
  1711.  
  1712.